#!/bin/bash

bin_name="collect"

#update
git pull

#build
go build .

#pack
rm -rf release
mkdir -v release

mkdir release/config
cp -v $bin_name release/$bin_name
cp -v run.sh release/
cp -rv config/config.toml release/config/config.toml

dd=$(date +%Y%m%d%H%M%S)
cd release/
commitid=`git log --pretty=format:"%h" -1`
tar -czvf $bin_name-$pack_env-$commitid.tar.gz *
cd ../
mv release/$bin_name-$pack_env-$commitid.tar.gz .
rm -rvf release
echo $bin_name-$pack_env-$commitid.tar.gz
#sz $bin_name-$pack_env-$commitid.tar.gz
